<%--
 *  File:    ForumSummary.jsp
 *  @Author: Kent Zhong 
 *  Date:    2002/04/22
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>
<%@ page import="com.oval.util.*"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom-tag.tld" prefix="custom"%>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.ForumSummary");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "BIEE";
  	String strTableName = "ovforum";
	String privilegeCode = "Z0401";
  	
  	//get current userinfo
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  	cat.debug("The userinfo is :"+CurUserInfo);
  	cat.info("enter my page");
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<%@ include file="/inc/PageDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>

<html>
<head>
<title>ForumSummary</title>
<PageFlow:CheckPageFlow pageName="forumsummary" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc"%>
<script language="JavaScript">

    function page_summary(actionvalue,orderbyname)
	{
	  var editform = summaryPrepare(forumsummaryform,actionvalue,orderbyname);
	  editform.action = "ForumSummary.jsp?<%= OvalTools.randomURL() %>";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();  
	}
	
	function page_new()
	{
	    location.href="ForumFrm.jsp?<%= OvalTools.randomURL() %>"
	}
	
	function page_edit()
	{
	    var id = document.forumsummaryform.forumid.value;
        var status = document.forumsummaryform.forumstatus.value;
        if(id == null || id.length == 0 || id == "" || id == "-1")
        {
            alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
            return;
        }
        if(status >= 20 )
        {
            alert("<%= message.getMessageDesc("CAN_NOT_EDIT_IT") %>");
            return;
        }    
        var editurl = "ForumFrm.jsp?<%= OvalTools.randomURL() %>&forumid=" + id ; 
        <%--[SCRIPT]  alert(editurl);  [SCRIPT]--%>
        location.href = editurl;
        <%--[SCRIPT]  location.reload(true);      [SCRIPT]--%>
	}
	
	function page_delete()
	{
	      var id = document.forumsummaryform.forumid.value;
          var status = document.forumsummaryform.forumstatus.value;
          if(id == null || id.length == 0 || id == "" || id == "-1")
          {
            alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
            return;
          }  
          if(status >= 20 )
          {
            alert("<%= message.getMessageDesc("CAN_NOT_DEL_IT") %>");
            return;
          }    
          var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
          if(!flag)
            return;
          document.forumsummaryform.actionname.value = "delete";
          document.forumsummaryform.target = "_self"; 
          isRunning = true; 
          document.forumsummaryform.submit();
	}
	
	function page_radiotrue(selforumctl,selforumid,selforumstatus)
	{
	    radiotrue(selforumctl);
	    document.forumsummaryform.forumid.value= selforumid;
	    document.forumsummaryform.forumstatus.value= selforumstatus;
	}
	
	function page_stop()
    {
            var id = document.forumsummaryform.forumid.value;
      	if(id == null || id.length == 0 || id == "" || id == "-1")
      	  return;
            var status = document.forumsummaryform.forumstatus.value;
      	if((parseInt(status)!=20) && (parseInt(status)!=40))
      	{
      	  alert("<%= message.getMessageDesc("J_CANT_CANCEL") %>");
      	  return;
      	}
      	var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_STOP") %>");
      	if(!flag)
        	  return;
      	document.forumsummaryform.forumid.value = id;
      	document.forumsummaryform.actionname.value = "stop";
      	document.forumsummaryform.target = "_self";
      	isRunning = true;
      	document.forumsummaryform.submit();
    }
	
<%--[SCRIPT]    [SCRIPT]--%>
</script>
</head>
<body>
<form name="forumsummaryform" method="post" action="../Dispatcher"
	target="_parent"><input type="hidden" name="pagename"
	value="forumsummary"> <input type="hidden" name="actionname"> <input
	type="hidden" name="languagecode" value="<%= strLanguageCode %>"> <%@ include
	file="/inc/PageLocation.inc"%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<td class="summary_top">
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td class="summary_top" colspan="2"></td>
			</tr>
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">

			<tr class="deepblue-left">
				<td width="22" class="title_center">&nbsp;</td>
				<td class="title_center" width="110"><a
					href="javascript:page_summary('orderby','forumcode')"><%=label.getLabelName("L_InfoCode")%></a></td>
				<td class="title_center" width="80"><a
					href="javascript:page_summary('orderby','forumtypename')"><%=label.getLabelName("L_InfoType")%></a></td>
				<td class="title_center"><a
					href="javascript:page_summary('orderby','forumtitle')"><%=label.getLabelName("L_Title")%></a></td>
				<td width="80" class="title_center"><a
					href="javascript:page_summary('orderby','createdate')"><%=label.getLabelName("L_EntryDate")%></a></td>
				<td width="80" class="title_center"><a
					href="javascript:page_summary('orderby','expiredate')"><%=label.getLabelName("L_ExpireDate")%></a></td>
				<td class="title_center" width="70"><a
					href="javascript:page_summary('orderby','makername')"><%=label.getLabelName("L_Resource")%></a></td>
				<td class="title_center" width="70"><a
					href="javascript:page_summary('orderby','statusname')"><%=label.getLabelName("L_Status")%></a></td>
			</tr>
			<%
            cat.info("start loop");
            Vector forumsummary=(Vector)pageContext.getAttribute("forumsummary");
            if(forumsummary==null)
            {
                forumsummary=new Vector();
            }
            cat.debug("forumsummary is :"+forumsummary);
            Integer nDefaultForumId = new Integer(-1);
            Integer nDefaultForumStatus=new Integer(-1);
            String strClassType = new String("");   
            int i=0;
            String strChecked = "";
            boolean bHasChecked = false;
          %>
			<logic:iterate id="forumsummaryitem" collection="<%= forumsummary %>">
				<%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            if(!bHasChecked)
            {
              nDefaultForumId = (Integer)((HashMap)pageContext.getAttribute("forumsummaryitem")).get("forumid");
              nDefaultForumStatus=(Integer)((HashMap)pageContext.getAttribute("forumsummaryitem")).get("status");
              bHasChecked = true;
              strChecked = "Checked";
            }
            else
            {
              strChecked = "";
            }
            i++;
          %>
				<tr onMouseOver="this.className='tr-over'"
					onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"
					onClick="javascript:page_radiotrue('forumid<%=JspHelper.filterNull(i)%>','<oval:write name="forumsummaryitem" property="forumid" />','<oval:write name="forumsummaryitem" property="status" />')"
					class="<%=JspHelper.filterNull( strClassType )%>">
					<td><input id="forumid<%=JspHelper.filterNull(i)%>" type="radio"
						name="radioids"
						value='<oval:write name="forumsummaryitem" property="forumid" />'
						class="normalradio" <%=JspHelper.filterNull(strChecked)%>></td>
					<td>&nbsp;<a
						href="ForumInfo.jsp?<%= OvalTools.randomURL() %>&forumid=<oval:write name="forumsummaryitem" property="forumid" />"><oval:write
						name="forumsummaryitem" property="forumcode" /></a></td>
					<td>&nbsp;<oval:write name="forumsummaryitem"
						property="forumtypename" /></td>
					<td>&nbsp;<oval:write name="forumsummaryitem" property="forumtitle" /></td>
					<td>&nbsp;<custom:dateWrite name="forumsummaryitem"
						property="createdate" /></td>
					<td>&nbsp;<custom:dateWrite name="forumsummaryitem"
						property="expiredate" /></td>
					<td>&nbsp;<oval:write name="forumsummaryitem" property="makername" /></td>
					<td>&nbsp;<oval:write name="forumsummaryitem" property="statusname" /></td>
				</tr>
			</logic:iterate>
			<%cat.info("end loop");%>

			<input type="hidden" name="forumid"
				value="<%=JspHelper.filterNull(nDefaultForumId)%>">
			<input type="hidden" name="forumstatus"
				value="<%=JspHelper.filterNull(nDefaultForumStatus)%>">

			<tr>
				<td colspan="8"><%@ include file="/inc/SummaryAction.inc"%></td>
			</tr>

		</table>
		</td>
	</tr>
	<tr>
		<td class="td_center"><a onclick="page_new();"><custom:button type="1"
			label="L_New" imgsrc="new.gif" border="0" style="width:60" /></a> <a
			onclick="page_edit();"><custom:button type="1" label="L_Edit"
			imgsrc="edit.gif" border="0" style="width:60" /></a> <a
			onclick="page_delete();"><custom:button type="1" label="L_Delete"
			imgsrc="delete.gif" border="0" style="width:60" /></a> <a
			onclick="page_stop()"><custom:button type="1" label="L_Stop"
			imgsrc="stop.gif" border="0" style="width:60" /></a></td>
	</tr>
</table>
</form>
</body>
</html>


